package com.leetcode.LC;

import java.util.HashMap;
import java.util.HashSet;

public class LC1207 {
    public boolean uniqueOccurrences(int[] arr) {

        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            if (map.containsKey(arr[i])) {
                map.put(arr[i], map.get(arr[i]) + 1);
            } else {
                map.put(arr[i], 1);
            }
        }
        HashSet<Integer> set = new HashSet<>();
        for (Integer value : map.values()) {
            set.add(value);
        }

        return map.size() == set.size() ? true : false;
    }

    public static void main(String[] args) {
        System.out.println(new LC1207().uniqueOccurrences(new int[]{1, 2}));
    }
}
